package com.fita.scheduler.dao;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Save;
import com.fita.entity.data.ExchangeRate;

import java.util.List;

/**
 * @description:
 * @author: 11200
 * @date: 2019/8/1
 */
@Dao
public interface ExchangeRateDao {

    /**
     * 获取所有汇率代码
     * @return
     */
    @Query("select e.currency_code as currency_code, min(e.currency_name) as currency_name, min(e.currency_symbol) as currency_symbol from exchange_rate e group by e.currency_code")
    public List<ExchangeRate> listAllExchangeRateCode();

    @Save("INSERT INTO `exchange_rate` (`create_time`, `currency_code`, `currency_name`, `currency_symbol`, `effective_time`, `operator`, `rate`)" +
            " VALUES (:createTime, :currencyCode, :currencyName, :currencySymbol, :effectiveTime, :operator, :rate) ")
    void create(ExchangeRate newExchangeRate);
}
